﻿using System.Collections.Generic;
using CoreLibrary.Repo;
using Entities.DataBase.Persistent;

namespace Entities.DataBase {

    public interface IProductCatalogRepository : IRepository<ProductCatalog> {

        void InitRoot();

        ProductCatalog GetRoot();

        void DeleteCatalog(int id);

        /// <summary>
        /// Append Catalog to Catalog with Catalog ID
        /// </summary>
        /// <param name="parentId">parent id</param>
        /// <param name="catalogItem"></param>
        /// <returns></returns>
        ProductCatalog AppendCatalog(int parentId, ProductCatalog catalogItem);

        /// <summary>
        /// Insert Catalog After Sepcific Catalog
        /// </summary>
        /// <param name="catalogId"></param>
        /// <param name="catalogItem"></param>
        /// <returns></returns>
        void InsertCatalogAfter(int catalogId, ProductCatalog catalogItem);

        /// <summary>
        /// Get Catalog based on id
        /// </summary>
        /// <param name="catId"></param>
        /// <returns></returns>
        ProductCatalog GetCatalog(int catId);

        /// <summary>
        /// Get Catalog Based on guid
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        ProductCatalog GetCatalogByName(string name);

        /// <summary>
        /// Get Parent Catalog of specifc Cat id
        /// </summary>
        /// <param name="catId"></param>
        /// <returns></returns>
        ProductCatalog GetParentCatalog(int catId);

        /// <summary>
        /// Get Single Path of this catalog
        /// </summary>
        /// <param name="catId"></param>
        /// <returns></returns>
        List<ProductCatalog> GetPath(int catId);

        /// <summary>
        /// Get children
        /// </summary>
        /// <param name="catId"></param>
        /// <returns></returns>
        List<ProductCatalog> GetChildren(int catId);

        /// <summary>
        /// Get adll Descendants
        /// </summary>
        /// <param name="catId"></param>
        /// <returns></returns>
        List<ProductCatalog> GetDescendants(int catId);

        List<ProductCatalog> GetLeafCatalogs();

        void UpdateCatalog(int catId, string name, string cName, string descripiton);
    }
}